<template>
  <div class="container-pt">
    <van-nav-bar
      left-arrow
      @click-left="$router.back()"
      fixed
      title="我的收藏"
    />
    <article-list
      :disable-swiper="false"
      v-for="item in list.data"
      :key="item.id"
      :list="item"
    >
      <van-button square type="warning" text="取消" @click="del(item.id)" />
    </article-list>
  </div>
</template>

<script>
import articleList from "@/components/article.vue";
import { userDataListApi } from "../../api/user";
import { getClickHandler } from "../../api/article";
export default {
  components: { articleList },
  data() {
    return {
      active: 0,
      list: {},
      page: "1",
      limit: "10",
    };
  },
  methods: {
    async onList() {
      const res = await userDataListApi({
        page: this.page,
        limit: this.limit,
      });
      this.list = res.data.list;
      console.log(this.list);
    },
    async del(val) {
      console.log(val);
      const res = await getClickHandler({
        type: "2",
        article_id: val,
        action: "del",
      });
      // console.log(res);
      this.$toast({
        message: res.data,
        icon: "success",
      });
      this.onList()
    },
  },
  created() {
    this.onList();
  },
};
</script>

<style>
</style>